package edu.corn.job.core.context;

import edu.corn.job.core.engine.JobRunner;

/**
 * 该类用于线程主动获取线程池中的runner类，用于主动pending。
 * tomcat是线程一对一，如果是jetty就不一定了。
 */
public class JobRunnerLocal {
    private static final ThreadLocal<JobRunner> threadLocal = new ThreadLocal<>();


    public static JobRunner getRunner() {
        return threadLocal.get();
    }

    public static void setRunner(JobRunner jobRunner) {
        threadLocal.set(jobRunner);
    }

    public static void removeRunner() {
        threadLocal.remove();
    }


}
